import React, { Component } from "react";
import Child1 from "./Child1";

import { Provider } from "./context";

class App extends Component {
  state = {
    count: 10,
  };

  increment = () => {
    this.setState((prevState) => ({
      count: prevState.count + 1,
    }));
  };

  decrement = () => {
    this.setState((prevState) => ({
      count: prevState.count - 1,
    }));
  };
  render() {
    return (
      <Provider
        value={{
          count: this.state.count,
          increment: this.increment,
          decrement: this.decrement,
        }}
      >
        <h3>context-cart</h3>
        <Child1 />
      </Provider>
    );
  }
}

export default App;
